package net.aiion.weave.util.net;

public final class HTMLEncoder implements Encoder
{
    private static final Encoder ENCODER_INSTANCE = new HTMLEncoder();

    private HTMLEncoder() {
    }

    @Override
    public String encode(final String aString) {
        // Replace the HTML special characters in the jsonQueue first
        // FIXME (waiting for AML...)
        String result = aString;
        result = result.replace("&", "&amp;");
        result = result.replace("<", "&lt;");
        result = result.replace(">", "&gt;");
        result = result.replace("\"", "&quot;");
        return result;
    }

    public static Encoder getInstance() {
        return ENCODER_INSTANCE;
    }
}
